
<?php
class Zendvn_Filter_RemoveCircumflex implements Zend_Filter_Interface{
       
       public function filter2($value){
          /*a à ả ã á ạ ă ằ ẳ ẵ ắ ặ â ầ ẩ ẫ ấ ậ b c d đ e è ẻ ẽ é ẹ ê ề ể ễ ế ệ
          f g h i ì ỉ ĩ í ị j k l m n o ò ỏ õ ó ọ ô ồ ổ ỗ ố ộ ơ ờ ở ỡ ớ ợ
          p q r s t u ù ủ ũ ú ụ ư ừ ử ữ ứ ự v w x y ỳ ỷ ỹ ý ỵ z*/
          
          $charatera = '#(à|ả|ã|á|ạ|ă|ằ|ẳ|ẵ|ắ|ặ|â|ầ|ẩ|ẫ|ấ|ậ)#imsU';
          $replaceCharatera = 'a';
          $value = preg_replace($charatera, $replaceCharatera, $value);
          
          $charaterA = '#(À|Á|Â|Ã|Ă|Ạ|Ả|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ắ|Ằ|Ẳ|Ẵ|Ặ)#imsU';
          $replaceCharaterA = 'A';
          $value = preg_replace($charaterA, $replaceCharaterA, $value);
          
          $charaterd = '#(đ)#imsU';
          $replaceCharaterd = 'd';
          $value = preg_replace($charaterd,$replaceCharaterd,$value);
          
          $charaterD = '#(Đ)#imsU';
          $replaceCharaterD = 'D';
          $value = preg_replace($charaterD,$replaceCharaterD,$value);
          
          $charatere = '#(è|ẻ|ẽ|é|ẹ|ê|ề|ể|ễ|ế|ệ)#imsU';
          $replaceCharatere = 'e';
          $value = preg_replace($charatere,$replaceCharatere,$value);
          
          $charaterE = '#(È|É|Ê|Ẹ|Ẻ|Ẽ|Ề|Ề|Ể|Ễ|Ệ)#imsU';
          $replaceCharaterE = 'E';
          $value = preg_replace($charaterE,$replaceCharaterE,$value);
       
          $charateri = '#(ì|ỉ|ĩ|í|ị)#imsU';
          $replaceCharateri = 'i';
          $value = preg_replace($charateri,$replaceCharateri,$value);
          
          $charaterI = '#(Ì|Í|Ĩ|Ỉ|Ị)#imsU';
          $replaceCharaterI = 'I';
          $value = preg_replace($charaterI,$replaceCharaterI,$value);
          
          $charatero = '#(ò|ỏ|õ|ó|ọ|ô|ồ|ổ|ỗ|ố|ộ|ơ|ờ|ở|ỡ|ớ|ợ)#imsU';
          $replaceCharatero = 'o';
          $value = preg_replace($charatero,$replaceCharatero,$value);
          
          $charaterO = '#(Ò|Ó|Ô|Õ|Ơ|Ọ|Ỏ|Ố|Ồ|Ổ|Ỗ|Ộ|Ớ|Ờ|Ở|Ỡ|Ợ)#imsU';
          $replaceCharaterO = 'O';
          $value = preg_replace($charaterO,$replaceCharaterO,$value);
                
          $charateru = '#(ù|ủ|ũ|ú|ụ|ư|ừ|ử|ữ|ứ|ự)#imsU';
          $replaceCharateru = 'u';
          $value = preg_replace($charateru,$replaceCharateru,$value);
          
          $charaterU = '#(Ù|Ú|Ũ|Ư|Ụ|Ủ|Ứ|Ừ|Ử|Ữ|Ự)#imsU';
          $replaceCharaterU = 'U';
          $value = preg_replace($charaterU,$replaceCharaterU,$value);
          
          $charatery = '#(ỳ|ỷ|ỹ|ý|ỵ)#imsU';
          $replaceCharatery = 'y';
          $value = preg_replace($charatery,$replaceCharatery,$value);
          
          $charaterY = '#(Ỳ|Ỵ|Ý|Ỷ|Ỹ)#imsU';
          $replaceCharaterY = 'Y';
          $value = preg_replace($charaterY,$replaceCharaterY,$value);
          
          $charaterW = '#( )#imsU';
          $replaceCharaterW = '-';
          $value = preg_replace($charaterW,$replaceCharaterW,$value);
          
          $charaterX = '#(/)#imsU';
          $replaceCharaterX = '-';
          $value = preg_replace($charaterX,$replaceCharaterX,$value);
          
          return  $value;
       }
       
       public function filter($value)
       {
        $charatera = '#(à|ả|ã|á|ạ|ă|ằ|ẳ|ẵ|ắ|ặ|â|ầ|ẩ|ẫ|ấ|ậ)#imsU';
          $replaceCharatera = 'a';
          $value = preg_replace($charatera, $replaceCharatera, $value);
          
          $charaterA = '#(À|Á|Â|Ã|Ă|Ạ|Ả|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ắ|Ằ|Ẳ|Ẵ|Ặ)#imsU';
          $replaceCharaterA = 'A';
          $value = preg_replace($charaterA, $replaceCharaterA, $value);
          
          $charaterd = '#(đ)#imsU';
          $replaceCharaterd = 'd';
          $value = preg_replace($charaterd,$replaceCharaterd,$value);
          
          $charaterD = '#(Đ)#imsU';
          $replaceCharaterD = 'D';
          $value = preg_replace($charaterD,$replaceCharaterD,$value);
          
          $charatere = '#(è|ẻ|ẽ|é|ẹ|ê|ề|ể|ễ|ế|ệ)#imsU';
          $replaceCharatere = 'e';
          $value = preg_replace($charatere,$replaceCharatere,$value);
          
          $charaterE = '#(È|É|Ê|Ẹ|Ẻ|Ẽ|Ề|Ề|Ể|Ễ|Ệ)#imsU';
          $replaceCharaterE = 'E';
          $value = preg_replace($charaterE,$replaceCharaterE,$value);
       
          $charateri = '#(ì|ỉ|ĩ|í|ị)#imsU';
          $replaceCharateri = 'i';
          $value = preg_replace($charateri,$replaceCharateri,$value);
          
          $charaterI = '#(Ì|Í|Ĩ|Ỉ|Ị)#imsU';
          $replaceCharaterI = 'I';
          $value = preg_replace($charaterI,$replaceCharaterI,$value);
          
          $charatero = '#(ò|ỏ|õ|ó|ọ|ô|ồ|ổ|ỗ|ố|ộ|ơ|ờ|ở|ỡ|ớ|ợ)#imsU';
          $replaceCharatero = 'o';
          $value = preg_replace($charatero,$replaceCharatero,$value);
          
          $charaterO = '#(Ò|Ó|Ô|Õ|Ơ|Ọ|Ỏ|Ố|Ồ|Ổ|Ỗ|Ộ|Ớ|Ờ|Ở|Ỡ|Ợ)#imsU';
          $replaceCharaterO = 'O';
          $value = preg_replace($charaterO,$replaceCharaterO,$value);
                
          $charateru = '#(ù|ủ|ũ|ú|ụ|ư|ừ|ử|ữ|ứ|ự)#imsU';
          $replaceCharateru = 'u';
          $value = preg_replace($charateru,$replaceCharateru,$value);
          
          $charaterU = '#(Ù|Ú|Ũ|Ư|Ụ|Ủ|Ứ|Ừ|Ử|Ữ|Ự)#imsU';
          $replaceCharaterU = 'U';
          $value = preg_replace($charaterU,$replaceCharaterU,$value);
          
          $charatery = '#(ỳ|ỷ|ỹ|ý|ỵ)#imsU';
          $replaceCharatery = 'y';
          $value = preg_replace($charatery,$replaceCharatery,$value);
          
          $charaterY = '#(Ỳ|Ỵ|Ý|Ỷ|Ỹ)#imsU';
          $replaceCharaterY = 'Y';
          $value = preg_replace($charaterY,$replaceCharaterY,$value);

          return  $value;
       }
    }
?>